package org.achartengine.internal;

import android.content.Context;
import android.content.Intent;
import org.achartengine.internal.chart.BarChart;
import org.achartengine.internal.chart.f;
import org.achartengine.internal.chart.h;
import org.achartengine.internal.chart.i;
import org.achartengine.internal.chart.j;
import org.achartengine.internal.model.g;
import org.achartengine.internal.renderer.DialRenderer;
import org.achartengine.internal.renderer.XYMultipleSeriesRenderer;

/* loaded from: classes2.dex */
public class a {
    public static final String a = "chart";
    public static final String b = "title";

    private a() {
    }

    public static final GraphicalView a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new f(gVar, xYMultipleSeriesRenderer));
    }

    public static final GraphicalView b(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new i(gVar, xYMultipleSeriesRenderer));
    }

    public static final GraphicalView c(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new org.achartengine.internal.chart.b(gVar, xYMultipleSeriesRenderer));
    }

    public static final GraphicalView a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        j jVar = new j(gVar, xYMultipleSeriesRenderer);
        jVar.a(str);
        return new GraphicalView(context, jVar);
    }

    public static final GraphicalView a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type) {
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new BarChart(gVar, xYMultipleSeriesRenderer, type));
    }

    public static final GraphicalView b(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type) {
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new h(gVar, xYMultipleSeriesRenderer, type));
    }

    public static final GraphicalView a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String[] strArr) {
        if (gVar == null || xYMultipleSeriesRenderer == null || strArr == null || gVar.a() != strArr.length) {
            throw new IllegalArgumentException("Dataset, renderer and types should be not null and the datasets series count should be equal to the types length");
        }
        a(gVar, xYMultipleSeriesRenderer);
        return new GraphicalView(context, new org.achartengine.internal.chart.c(gVar, xYMultipleSeriesRenderer, strArr));
    }

    public static final GraphicalView a(Context context, org.achartengine.internal.model.a aVar, org.achartengine.internal.renderer.a aVar2) {
        a(aVar, aVar2);
        return new GraphicalView(context, new org.achartengine.internal.chart.g(aVar, aVar2));
    }

    public static final GraphicalView a(Context context, org.achartengine.internal.model.a aVar, DialRenderer dialRenderer) {
        a(aVar, dialRenderer);
        return new GraphicalView(context, new org.achartengine.internal.chart.d(aVar, dialRenderer));
    }

    public static final GraphicalView a(Context context, org.achartengine.internal.model.c cVar, org.achartengine.internal.renderer.a aVar) {
        a(cVar, aVar);
        return new GraphicalView(context, new org.achartengine.internal.chart.e(cVar, aVar));
    }

    public static final Intent d(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        return c(context, gVar, xYMultipleSeriesRenderer, "");
    }

    public static final Intent e(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        return d(context, gVar, xYMultipleSeriesRenderer, "");
    }

    public static final Intent f(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        return e(context, gVar, xYMultipleSeriesRenderer, "");
    }

    public static final Intent b(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str) {
        return a(context, gVar, xYMultipleSeriesRenderer, str, "");
    }

    public static final Intent c(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type) {
        return a(context, gVar, xYMultipleSeriesRenderer, type, "");
    }

    public static final Intent c(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new f(gVar, xYMultipleSeriesRenderer));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent d(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new i(gVar, xYMultipleSeriesRenderer));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent e(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new org.achartengine.internal.chart.b(gVar, xYMultipleSeriesRenderer));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String str, String str2) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        j jVar = new j(gVar, xYMultipleSeriesRenderer);
        jVar.a(str);
        intent.putExtra(a, jVar);
        intent.putExtra(b, str2);
        return intent;
    }

    public static final Intent a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new BarChart(gVar, xYMultipleSeriesRenderer, type));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent b(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, BarChart.Type type, String str) {
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new h(gVar, xYMultipleSeriesRenderer, type));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent a(Context context, g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer, String[] strArr, String str) {
        if (gVar == null || xYMultipleSeriesRenderer == null || strArr == null || gVar.a() != strArr.length) {
            throw new IllegalArgumentException("Datasets, renderers and types should be not null and the datasets series count should be equal to the types length");
        }
        a(gVar, xYMultipleSeriesRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new org.achartengine.internal.chart.c(gVar, xYMultipleSeriesRenderer, strArr));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent a(Context context, org.achartengine.internal.model.a aVar, org.achartengine.internal.renderer.a aVar2, String str) {
        a(aVar, aVar2);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new org.achartengine.internal.chart.g(aVar, aVar2));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent a(Context context, org.achartengine.internal.model.c cVar, org.achartengine.internal.renderer.a aVar, String str) {
        a(cVar, aVar);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new org.achartengine.internal.chart.e(cVar, aVar));
        intent.putExtra(b, str);
        return intent;
    }

    public static final Intent a(Context context, org.achartengine.internal.model.a aVar, DialRenderer dialRenderer, String str) {
        a(aVar, dialRenderer);
        Intent intent = new Intent(context, b.class);
        intent.putExtra(a, new org.achartengine.internal.chart.d(aVar, dialRenderer));
        intent.putExtra(b, str);
        return intent;
    }

    private static void a(g gVar, XYMultipleSeriesRenderer xYMultipleSeriesRenderer) {
        if (gVar == null || xYMultipleSeriesRenderer == null || gVar.a() != xYMultipleSeriesRenderer.a()) {
            throw new IllegalArgumentException("Dataset and renderer should be not null and should have the same number of series");
        }
    }

    private static void a(org.achartengine.internal.model.a aVar, org.achartengine.internal.renderer.a aVar2) {
        if (aVar == null || aVar2 == null || aVar.c() != aVar2.a()) {
            throw new IllegalArgumentException("Dataset and renderer should be not null and the dataset number of items should be equal to the number of series renderers");
        }
    }

    private static void a(org.achartengine.internal.model.c cVar, org.achartengine.internal.renderer.a aVar) {
        if (cVar == null || aVar == null || !a(cVar, aVar.a())) {
            throw new IllegalArgumentException("Titles and values should be not null and the dataset number of items should be equal to the number of series renderers");
        }
    }

    private static boolean a(org.achartengine.internal.model.c cVar, int i) {
        int b2 = cVar.b();
        boolean z = true;
        for (int i2 = 0; i2 < b2 && z; i2++) {
            z = cVar.b(i2).length == cVar.e(i2).length;
        }
        return z;
    }
}
